﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using XuanXiang.Infrastructure.Dto.Response.System;
using XuanXiang.Infrastructure.EFCore.MySql;
using XuanXiang.Infrastructure.Tools;
using XuanXiang.Service.Interface;

namespace XuanXiang.Api.Admin.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BaseController : ControllerBase
    {
        protected readonly I_Login_Service _login_Service;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="login_Service"></param>
        public BaseController(I_Login_Service login_Service)
        {
            _login_Service = login_Service;

           
           // Thread.Sleep(Config.GetRandom(1000,2000));
        }

        /// <summary>
        /// 获取当前登录对象
        /// </summary>
        /// <returns></returns>
        protected Users_Dto Get_User()
        {
            var code = Response.HttpContext.User.Identity?.Name;

            return _login_Service.Check_Login(code!,"");
        }

        

        
    }
}
